Skip to content

examples: add vision odometry example#820

Open
alireza787b wants to merge 4 commits intomavlink:mainfrom
alireza787b:add-vision-odometry-example
Open

examples: add vision odometry example#820
alireza787b wants to merge 4 commits intomavlink:mainfrom
alireza787b:add-vision-odometry-example

Conversation

@alireza787b
Copy link
Copy Markdown
Contributor

@alireza787b alireza787b commented Mar 10, 2026

Summary

Adds a vision odometry example that feeds simulated VIO data to PX4 using the MAVSDK Mocap plugin, for testing and education.

This script does NOT arm, takeoff, or control the drone. It only feeds VIO data in the background. You fly the drone however you like (QGroundControl, RC, mission, or another MAVSDK script) while this runs alongside.

Current status

This PR is not merge-ready yet.

It is waiting on the fresh upstream mocap path:

The earlier dependency chain in this PR description was stale:

After the proto/C++ path is settled, this example still needs one final pass and verification before it should be merged.

Planned follow-up for this PR

  • refresh the dependency note once the upstream mocap PRs are settled
  • do one final cleanup and validation pass on the example itself
  • mark the PR merge-ready only after that

Test plan

Pending the upstream mocap proto/C++ path.

Add a practical example showing how to send visual odometry data
to PX4 via the Mocap plugin's Odometry message. Demonstrates
connecting to PX4 SITL, configuring EKF2 for vision fusion
(EKF2_EV_CTRL, EKF2_HGT_REF), sending ODOMETRY at 30 Hz, and
monitoring health to verify fusion is active.
@alireza787b alireza787b force-pushed the add-vision-odometry-example branch from 5fa5637 to 145905e Compare March 10, 2026 05:49
alireza787b and others added 2 commits March 10, 2026 06:40
Rewrites the vision odometry example to use a ground truth feedback
approach: reads the drone's actual position in simulation, adds
configurable noise and delay, and feeds it back as vision odometry.
The drone takes off and hovers while the VIO feed runs, showing
real-time EKF2 fusion status.

Uses new Odometry fields (reset_counter, estimator_type, quality)
from MAVSDK-Proto PR mavlink#395 / MAVSDK PR #2791. Includes a startup
validation that prints a clear error if these fields are not yet
available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The vision odometry example now does NOT arm, takeoff, or control the
drone. It only feeds VIO data. The user flies the drone however they
like (QGroundControl, RC, mission, another script) while this runs
alongside. Press Ctrl+C to stop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JonasVautherin
JonasVautherin previously approved these changes Mar 10, 2026
Copy link
Copy Markdown
Collaborator

@JonasVautherin JonasVautherin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

Match proto field rename from MAVSDK-Proto PR mavlink#395 review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alireza787b
Copy link
Copy Markdown
Contributor Author

Thanks for the review Jonas! Just pushed a small update renaming qualityquality_percent to match the proto change from your feedback on #395.

Copy link
Copy Markdown
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to be merged? The todos in the PR description aren't ticked, so I'm not so sure.

@alireza787b
Copy link
Copy Markdown
Contributor Author

Hey Juliano, not yet. You are right that the description there was stale, thanks for flagging it. I just cleaned that up. This example is waiting on the fresh proto PR (MAVSDK-Proto#404) and then the clean replacement MAVSDK PR for the mocap wiring. After that I still want to do one final pass on the example itself before calling it merge-ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants